<%--
 *  File:    DoctorPlanManage.jsp
 *  @Author: jackwang	
 *  Date:    2013/7/4
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>

<%
  //init param
  Category cat = Category.getInstance("jsp.DoctorPlanManage");
  String strModuleName = "COM";
  String strTableName = "v_docreportplan";
  String privilegeCode = "A01007";
  String contextPath = request.getContextPath();

%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc"%>
<%@ include file="/inc/FrmDefault.inc"%>
<%@ include file="/inc/PageDefault.inc"%>
<%@ include file="/inc/LocationDefault.inc"%>
<%@include file="/inc/Print.inc"%>
<%@ include file="/rpt/ReportURL.inc"%>
<html>
<head>
<title>DoctorPlanManage</title>
<PageFlow:CheckPageFlow pageName="p_docreportplan" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/cn/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc"%>
<%
	Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
	if(searchresults == null) searchresults = new Vector();
	HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
	if(UserInfo == null) UserInfo = new HashMap();
	String isfirst = (String)pageContext.getAttribute("isfirst");
    if(isfirst == null)isfirst = "";
	//System.out.println(searchresults.size()+"[");
%>
<script>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "DoctorPlanManage.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}
function monthresult(){
	document.cform.actionname.value = "save";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}
function page_add(){
	document.cform.actionname.value = "add";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}
window.onload=function(){
          // cform.startdate.value=new Date().toFormatString("yyyy-mm-dd");
          // cform.enddate.value=new Date().toFormatString("yyyy-mm-dd");
}
function popAreaNew(num){
	if(popwindow!=null) popwindow.close();
	if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
    if(isEmpty(document.cform.areaid1.value)){
      alert("请选择省区！");
      document.cform.stdareaname.focus();
      return;
    }
	var currentnum = document.cform.currentnum.value;
    url = 'AreaPopWindow.jsp?areaid1='+document.cform.areaid1.value+'&<%= OvalTools.randomURL() %>';
    attribute = 'height=300, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
function SetAreaPop(areaid,areacode,areaname){
	var currentnum = document.cform.currentnum.value;
	document.cform['areaid2'+currentnum].value = areaid;
	//document.cform['businessareacode'+currentnum].value = areacode;
	document.cform['areaname'+currentnum].value = areaname;
}
function popBusinessarea(num){
    //url = "UserAreaAllWindow.jsp?<%= OvalTools.randomURL() %>";
    if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	var currentnum = document.cform.currentnum.value;
    url = "<%=contextPath%>/masterdata/upm/UserStdAreaAllWindow.jsp?<%= OvalTools.randomURL() %>";
    attribute = "height=400, width=650,top=100,left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	popwindow = window.open(url,"newwindow", attribute);
}

function set_orgNameByAreaWindow(id,areaname){
    var currentnum = document.cform.currentnum.value;
    document.cform['areaid1'+currentnum].value = id;
    document.cform['stdareaname'+currentnum].value = areaname;
}
function popWindowsContactProd(num){
    if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	var currentnum = document.cform.currentnum.value;
 	if(isEmpty(document.cform['criteriontype'+currentnum].value)){
      alert("请选择类型！");
      document.cform['criteriontype'+currentnum].focus();
      return;
    }
    var criteriontype=document.cform['criteriontype'+currentnum].value;
    if(criteriontype==1)  document.cform['datacategory'+currentnum].value=7;
    if(criteriontype==2)  document.cform['datacategory'+currentnum].value=8;
    if(criteriontype==3)  document.cform['datacategory'+currentnum].value=14;
    if(popwindow!=null) popwindow.close();
 	popwindow = window.open("<%=contextPath%>/masterdata/ogm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&zyldatacategory="+document.cform['datacategory'+currentnum].value, "newwindow", "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=yes")

}
 function set_orgNameByPopWindow(id,code,name){
    var currentnum = document.cform.currentnum.value;
    idObj=document.getElementById("productgroupid"+currentnum);
    nameObj=document.getElementById("productgroupname"+currentnum);
    //captionname=document.getElementById("captionname"+idx);
	nameObj.value=name;
	//captionname.value=name;
	idObj.value=id;
    //document.getElementById("captionname"+idx).command="notnull";
}
 function showdiv(num){
    if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	var currentnum = document.cform.currentnum.value;
 	if(document.cform['criteriontype'+currentnum].value==3 && document.cform['opentype'+currentnum].value==2){
 	 document.cform['analyzecriteria'+currentnum].disabled='';
 	 document.cform['analyzecriteria'+currentnum].command="notnull";
 	}else{
 	 document.cform['analyzecriteria'+currentnum].disabled=true;
 	}
}


function page_upload(){
		var year=document.cform.year.value;
		this.location.href = "<%= contextPath%>/zylprocessgoals/ZylUploadTempDoctorPlan.jsp?&<%= OvalTools.randomURL() %>&year="+year;
}


function page_downexport() {
    var year=document.cform.year.value;
    var deptid=document.cform.deptname.value;
	var url = "<%=reportURL%>/servlet/ExcecuteReport/temp_doctorplan.sox?__format=xlsx&__folder=/ovalreport&e1="+document.cform.userid.value+"&year="+year+"&deptid="+deptid;
	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
	popwindow = window.open(url, "n1window", strstatus);
	                
}



	 
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
	<form name="cform" method="post" action="<%=contextPath %>/Dispatcher">
	<input type="hidden" name="pagename" value="p_docreportplan">
	<input type="hidden" name="isfirst" value="N">
	<input type="hidden" name="actionname">
	<input type="hidden" name="currentnum">
	<input type="hidden" name="datacategory">
	<input type="hidden" name="numrows" value="<%=searchresults.size() %>" />
	<custom:hidden scope="session" name="userinfo" property="userid"></custom:hidden>
	<table width="100%" cellspacing="0">
		<% //--------------------------------------  page location --%>
		<%@ include file="/inc/PageLocation.inc"%>
	</table>
	<table width="100%" cellspacing="0" border="0" cellpadding="0">
		<tr>
			<td>
			<table width="800" border="0" cellspacing="0"
				onkeydown="if(event.keyCode==13) page_summary('search');">
				<tr>

					<td>
					<div align="left"><font color=black><%= label.getLabelName("L_Year1") + label.getLabelName("L_Colon") %></font>
					</div>
					</td>
					<td><custom:selectdic property="year" dictType="Years" /></td>
					<td>
					<% if(!("N".equals(isfirst))){ %>
				     <script type="text/javascript">
		                    var d = new Date();
                            var year=d.getFullYear();
                            document.cform.year.value=year;
		             </script>
				    <%}%>
					<div align="left"><font color=black><%= label.getLabelName("L_Doctorcode") + label.getLabelName("L_Colon") %></font>
					</div>
					</td>
					<td><custom:text property="doctorcode" /></td>
					<td>
					<div align="left"><font color=black><%= label.getLabelName("L_DoctorName") + label.getLabelName("L_Colon") %></font>
					</div>
					</td>
					<td><custom:text property="doctorname" /></td>
					<!-- 
					<td><%=label.getLabelName("L_Type")+ label.getLabelName("L_Colon")%></td>
					<td><custom:selectdic dictType="DicrelationType" property="quarter" valueCriteria="3"/></td>
					 -->
					<td><%=label.getLabelName("L_Dept") +label.getLabelName("L_Colon")%></td>
					<td><custom:select property="deptname" optionsName="alldeptnames" optionValueKey="deptid" optionInnerTextKey="deptname"
						defaultValue="--------" defaultValueCost="" />
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
					<a href="javascript:page_summary('search')">
					  <img src="<%= contextPath %>/images/<%= strLanguageCode %>/go_fy.gif" border="0" style="border: 1 solid #000000"></a>
					</td>
			</table>
			</td>
		</tr>
		<tr>
			<td>
			<div style="overflow:auto;height:380;" id="scrollGDiv">
			<table border="1" cellspacing="0" bordercolorlight="#999999"
				bordercolordark="#FFFFFF" cellpadding="0" width="3000">
				<tr class="deepblue-left">
					<td width="1%" class="title_center" rowspan="2">&nbsp;</td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Provicetdr")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Dept")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_RegionOffice")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_ManagerCode")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_ManagerName")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Employeecode")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_employeenameDelegate")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Doctorcode")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_DoctorName")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Terminal")%><%=label.getLabelName("L_Code")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Terminal")%><%=label.getLabelName("L_Name")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_YesOrNoOpen")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_YesOrNoBale")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Country")%><%=label.getLabelName("L_Grade")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Grade")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Yl_Level")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_StandardDept")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_FactDept")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Variety")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_DoctorRecipel")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Doctor")%><%=label.getLabelName("L_Grade")%></td>
					<td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_CurrentlyStatus")%></td>

					<td class="title_center" width="8%" colspan="3">1<%=label.getLabelName("L_Quarter") %></td>
					<td class="title_center" width="8%" colspan="3">2<%=label.getLabelName("L_Quarter") %></td>
					<td class="title_center" width="8%" colspan="3">3<%=label.getLabelName("L_Quarter") %></td>
					<td class="title_center" width="8%" colspan="3">4<%=label.getLabelName("L_Quarter") %></td>
				</tr>

				<tr class="deepblue-left">
					<td class="title_center"><%= label.getLabelName("L_ThreeTarget") %></td>
					<td class="title_center"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Grade")%></td>
					<td class="title_center"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Prescription")%></td>
					<td class="title_center"><%= label.getLabelName("L_ThreeTarget") %></td>
					<td class="title_center"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Grade")%></td>
					<td class="title_center"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Prescription")%></td>
					<td class="title_center"><%= label.getLabelName("L_ThreeTarget") %></td>
					<td class="title_center"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Grade")%></td>
					<td class="title_center"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Prescription")%></td>
					<td class="title_center"><%= label.getLabelName("L_ThreeTarget") %></td>
					<td class="title_center"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Grade")%></td>
					<td class="title_center"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Prescription")%></td>
				</tr>
				<%
             int j = 0;
             int s=1;
             String strClassType = new String();
             String strIsChecked = "";
             Integer defaultId = new Integer(-1);
             boolean bHasChecked = false;
            
          %>
				<logic:iterate id="doctors" collection="<%= searchresults %>"
					indexId="seq">
					<%
            HashMap doctorinfo = (HashMap)pageContext.getAttribute("doctors");
            if(j%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "";
            }

           if(!bHasChecked)
            {
              strIsChecked = "Checked";
              //defaultId = (Integer)pageConfig.get("opencriterionid");
              bHasChecked = true;
              
            }else{
           		strIsChecked = "";
            }
            // s= ((Integer)pageConfig.get("opencriterionid")).intValue();
            j++;
          %>
					<tr onmouseover="this.className='tr-over'"
						onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"
						class="<%=JspHelper.filterNull(strClassType)%>"
						onclick="javascript:radiotrue('radio<%=JspHelper.filterNull(j)%>');clickRow('<custom:write name="doctors" property="docstdprocessgoalsid" nbsp="true"/>')">
						<td><input class="normalradio"
							id="radio<%=JspHelper.filterNull(j)%>" type="radio"
							name="doctorinfo" changedName="fileids"
							<%=JspHelper.filterNull( strIsChecked)%>></td>
						<td><custom:write name="doctors" property="area1name" />&nbsp;</td>
						<td><custom:write name="doctors" property="deptname" />&nbsp;</td>
						<td><custom:write name="doctors" property="area2name" />&nbsp;</td>
						<td><custom:write name="doctors" property="parentemployeecode" />&nbsp;</td>
						<td><custom:write name="doctors" property="parentemployeename" />&nbsp;</td>
						<td><custom:write name="doctors" property="employeecode" />&nbsp;</td>
						<td><custom:write name="doctors" property="employeename" />&nbsp;</td>
						<td><custom:write name="doctors" property="doctorcode" />&nbsp;</td>
						<td><custom:write name="doctors" property="doctorname" />&nbsp;</td>
						<td><custom:write name="doctors" property="orgcode" />&nbsp;</td>
						<td><custom:write name="doctors" property="orgname" />&nbsp;</td>
						<td><custom:write name="doctors" property="isdeveloped" dictType="YesOrNo"/>&nbsp;</td>
						<td><custom:write name="doctors" property="isbale" dictType="YesOrNo"/>&nbsp;</td>
						<td><custom:write name="doctors" property="organalysisattr1" />&nbsp;</td>
						<td><custom:write name="doctors" property="organalysisattr2" />&nbsp;</td>
						<td><custom:write name="doctors" property="organalysisattr3" />&nbsp;</td>
						<td><custom:write name="doctors" property="stddeptname" />&nbsp;</td>
						<td><custom:write name="doctors" property="hospitaldeptname" />&nbsp;</td>
						<td><custom:write name="doctors" property="productgroupname" />&nbsp;</td>
						<td><custom:write name="doctors" property="qty" />&nbsp;</td>
						<td><custom:write name="doctors" property="doctorlevel" />&nbsp;</td>
						<td><custom:write name="doctors" property="currentstate" dictType="IsOpen"/>&nbsp;</td>
						<td><custom:write name="doctors" property="type1" />&nbsp;</td>
						<td><custom:write name="doctors" property="level1" />&nbsp;</td>
						<td><custom:write name="doctors" property="qty1" />&nbsp;</td>
						<td><custom:write name="doctors" property="type2" />&nbsp;</td>
						<td><custom:write name="doctors" property="level2" />&nbsp;</td>
						<td><custom:write name="doctors" property="qty2" />&nbsp;</td>
						<td><custom:write name="doctors" property="type3" />&nbsp;</td>
						<td><custom:write name="doctors" property="level3" />&nbsp;</td>
						<td><custom:write name="doctors" property="qty3" />&nbsp;</td>
						<td><custom:write name="doctors" property="type4" />&nbsp;</td>
						<td><custom:write name="doctors" property="level4" />&nbsp;</td>
						<td><custom:write name="doctors" property="qty4" />&nbsp;</td>
					</tr>
				</logic:iterate>



				<% //--------------------------------------  flipping page --%>
				<%@ include file="/inc/SummaryAction.inc"%>
			</table>
			</td>
		</tr>
		</div>
		<table width="100%">
					<tr>
						<td class="summary_top"></td>
					</tr>
					<tr>
						<td class="td_center"><a onclick="page_upload();"><custom:button
							type="1" label="L_Upload" imgsrc="CreatSubDept.gif"
							style="width:60" /></a> <a onclick="page_downexport();"><custom:button
							type="1" label="L_TemplateDownReport" imgsrc="CreatSubDept.gif"
							style="width:90" /></a></td>
					</tr>
	    </table>
	</table>
	</form>
</table>

<script>
  document.getElementById("scrollGDiv").style.width=(screen.availWidth - 30);
</script>
</body>
</html>


